package com.neu.wms.service.impl;

import com.neu.wms.dto.ItemDto;
import com.neu.wms.entity.WmsItem;
import com.neu.wms.mapper.WmsItemMapper;
import com.neu.wms.service.ItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ItemServiceImpl implements ItemService {
    @Autowired
    private WmsItemMapper wmsItemMapper;

    @Override
    public List<WmsItem> selectAll(ItemDto itemDto) {
        return wmsItemMapper.selectAll(itemDto);
    }

    @Override
    public int insert(WmsItem item) {
        item.setDelFlag(0);
        return wmsItemMapper.insertSelective(item);
    }

    @Override
    public int update(WmsItem wmsItem) {
        return wmsItemMapper.updateByPrimaryKeySelective(wmsItem);
    }

    @Override
    public int delete(Long id) {
        return wmsItemMapper.deleteByPrimaryKey(id);
    }

    @Override
    public WmsItem selectByPrimaryKey(Long id) {
        return wmsItemMapper.selectByPrimaryKey(id);
    }

    @Override
    public int updateDelFlag(ItemDto itemDto) {
        return wmsItemMapper.updateDelFlag(itemDto);
    }

}
